{extend name="admin@public/base" /}
{block name="main-content"}
	<div class="page-content">
		<div class="row maintop">
			<div class="col-xs-12">
				<button class="btn btn-xs btn-danger" data-toggle="modal" data-target="#myModal">
					<i class="ace-icon fa fa-plus bigger-110"></i>
					添加关键词
				</button>
			</div>
		</div>
		<div class="row">
			<div class="col-xs-12">
				<div>
					<form class="ajaxForm2" name="leftnav" method="post" action="{:url('wechat/We/reply_alldel')}" >
						<table id="dynamic-table" class="table table-striped table-bordered table-hover">
							<thead>
							<tr>
								<th class="hidden-xs center">
										<label class="pos-rel">
											<input type="checkbox" class="ace"  id='chkAll' onclick='CheckAll(this.form)' value="全选"/>
											<span class="lbl"></span>
										</label>
									</th>
								<th>ID</th>
								<th>关键词</th>
								<th>回复类型</th>
								<th>回复内容/素材ID</th>
								<th class="hidden-sm hidden-xs">添加时间</th>
								<th>开启状态</th>
								<th style="border-right:#CCC solid 1px;">操作</th>
							</tr>
							</thead>

							<tbody id="ajax-data">
								{include file="we/ajax_reply_list"/}
							</tbody>
						</table>
					</form>
				</div>
			</div>
		</div>
		<!-- 显示模态框（Modal）-->
		<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
			<form class="form-horizontal ajaxForm2" name="we_reply_runadd" id="we_reply_runadd" method="post" action="{:url('wechat/We/reply_runadd')}">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal"
									aria-hidden="true">×
							</button>
							<h4 class="modal-title" id="myModalLabel">
								添加关键词
							</h4>
						</div>
						<div class="modal-body">

							<div class="row">
								<div class="col-xs-12">

									<div class="form-group">
										<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 关键词：  </label>
										<div class="col-sm-10">
											<input type="text" name="we_reply_key" id="we_reply_key" placeholder="输入关键词" class="col-xs-10 col-sm-5" required/>
										</div>
									</div>
									<div class="space-4"></div>

									<div class="form-group">
										<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 回复类型： </label>
										<div class="col-sm-10">
											<select name="we_reply_type"  class="col-sm-4 we_reply_type" id="we_reply_type" required>
												<option value="text" selected>文字回复</option>
												<option value="image">图片回复</option>
												<option value="voice">声音回复</option>
												<option value="news">图文回复</option>
											</select>
										</div>
									</div>
									<div class="space-4"></div>
									<div id="input-text">
										<div class="form-group">
											<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 回复内容：  </label>
											<div class="col-sm-10">
												<input type="text" name="we_reply_content" id="we_reply_content" placeholder="回复文本或素材ID" class="col-xs-10 col-sm-5"/>
												<span class="lbl">&nbsp;&nbsp;<span class="red">*</span>回复文本或素材ID</span>
											</div>
										</div>
										<div class="space-4"></div>
									</div>
									<div id="input-news">
										<div class="form-group">
											<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 图文标题：  </label>
											<div class="col-sm-10">
												<input type="text" name="news_title" placeholder="" class="col-xs-10 col-sm-5" />
												<span class="lbl">&nbsp;&nbsp;<span class="red"></span></span>
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 图文简介：  </label>
											<div class="col-sm-10">
												<input type="text" name="news_description" placeholder="" class="col-xs-10 col-sm-5" />
												<span class="lbl">&nbsp;&nbsp;<span class="red"></span></span>
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 图文链接：  </label>
											<div class="col-sm-10">
												<input type="text" name="news_url" placeholder="" class="col-xs-10 col-sm-5" />
												<span class="lbl">&nbsp;&nbsp;<span class="red"></span></span>
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 图片地址：  </label>
											<div class="col-sm-10">
												<input type="text" name="news_image" placeholder="" class="col-xs-10 col-sm-5" />
												<span class="lbl">&nbsp;&nbsp;<span class="red"></span></span>
											</div>
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 是否开启： </label>
										<div class="col-sm-10" style="padding-top:5px;">
											<input name="we_reply_open" id="we_reply_open" value="1" class="ace ace-switch ace-switch-4 btn-flat" type="checkbox" />
											<span class="lbl">&nbsp;&nbsp;默认关闭</span>
										</div>
									</div>
									<div class="space-4"></div>

								</div>
							</div>
					</div>
						<div class="modal-footer">
							<button type="submit" class="btn btn-primary">
								提交保存
							</button>
							<button class="btn btn-info" type="reset">
								重置
							</button>
							<button type="button" class="btn btn-default" data-dismiss="modal">
								关闭
							</button>
						</div>
					</div><!-- /.modal-content -->
				</div><!-- /.modal-dialog -->
			</form>
		</div><!-- /.modal -->
		<!-- 修改自定义菜单模态框（Modal） -->
		<div class="modal fade in" id="myModaledit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
			<div class="modal-backdrop fade in" id="gbbb" style="height: 100%;"></div>
			<form class="form-horizontal ajaxForm2" name="we_reply_runedit" id="we_reply_runedit" method="post" action="{:url('wechat/We/reply_runedit')}">
				<input type="hidden" name="we_reply_id" id="editwe_reply_id" value="" />
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" id="gb"  data-dismiss="modal"
									aria-hidden="true">×
							</button>
							<h4 class="modal-title" id="myModalLabel">
								修改关键词回复
							</h4>
						</div>
						<div class="modal-body">
							<div class="row">
								<div class="col-xs-12">

									<div class="form-group">
										<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 关键词：  </label>
										<div class="col-sm-10">
											<input type="text" name="we_reply_key" id="editwe_reply_key" placeholder="输入关键词" class="col-xs-10 col-sm-5" required/>
										</div>
									</div>
									<div class="space-4"></div>

									<div class="form-group">
										<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 回复类型： </label>
										<div class="col-sm-10">
											<select name="we_reply_type"  class="col-sm-4 we_reply_type" id="editwe_reply_type" required>
												<option value="text" selected>文字回复</option>
												<option value="image">图片回复</option>
												<option value="voice">声音回复</option>
												<option value="news">图文回复</option>
											</select>
										</div>
									</div>
									<div class="space-4"></div>
									<div id="input-text">
										<div class="form-group">
											<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 回复内容：  </label>
											<div class="col-sm-10">
												<input type="text" name="we_reply_content" id="editwe_reply_content" placeholder="" class="col-xs-10 col-sm-5" />
												<span class="lbl">&nbsp;&nbsp;<span class="red"></span></span>
											</div>
										</div>
										<div class="space-4"></div>
									</div>
									<div id="input-news">
										<div class="form-group">
											<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 图文标题：  </label>
											<div class="col-sm-10">
												<input type="text" name="news_title" placeholder="" id="editnews_title" class="col-xs-10 col-sm-5" />
												<span class="lbl">&nbsp;&nbsp;<span class="red"></span></span>
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 图文简介：  </label>
											<div class="col-sm-10">
												<input type="text" name="news_description" placeholder="" id="editnews_description" class="col-xs-10 col-sm-5" />
												<span class="lbl">&nbsp;&nbsp;<span class="red"></span></span>
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 图文链接：  </label>
											<div class="col-sm-10">
												<input type="text" name="news_url" placeholder="" id="editnews_url" class="col-xs-10 col-sm-5" />
												<span class="lbl">&nbsp;&nbsp;<span class="red"></span></span>
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 图片地址：  </label>
											<div class="col-sm-10">
												<input type="text" name="news_image" placeholder="" id="editnews_image" class="col-xs-10 col-sm-5" />
												<span class="lbl">&nbsp;&nbsp;<span class="red"></span></span>
											</div>
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 是否开启： </label>
										<div class="col-sm-10" style="padding-top:5px;">
											<input name="we_reply_open" id="editwe_reply_open" value="1" class="ace ace-switch ace-switch-4 btn-flat" type="checkbox" />
											<span class="lbl">&nbsp;&nbsp;默认关闭</span>
										</div>
									</div>
									<div class="space-4"></div>

								</div>
							</div>
						</div>
						<div class="modal-footer">
							<button type="submit" class="btn btn-primary">
								提交保存
							</button>
							<button type="button" class="btn btn-default" id="gbb" >
								关闭
							</button>
						</div>
					</div><!-- /.modal-content -->
				</div><!-- /.modal-dialog -->
			</form>
		</div><!-- /.modal -->
	</div><!-- /.page-content -->
{/block}
{block name="scripts"}
<script>
$(function () {
	$("#input-news").hide();
	$('#we_reply_type,#editwe_reply_type').change(function () {
		var $type=$(this).val(),Modal=$(this).parents('.modal');
        //是否切换开关
        if($type=='news'){
            Modal.find("#input-text").hide();
			Modal.find("#input-news").show();
        }else{
            Modal.find("#input-text").show();
			Modal.find("#input-news").hide();
        }
	});
});
</script>
{/block}